//
//  SHD_ChipWebViewController.m
//  B段项目
//
//  Created by dllo on 15/11/5.
//  Copyright © 2015年 谢美娜. All rights reserved.
//

#import "SHD_ChipWebViewController.h"

@interface SHD_ChipWebViewController ()<UIWebViewDelegate>
@property(nonatomic, strong)XMN_ProgressHUD *HUD;
@end

@implementation SHD_ChipWebViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    _chipDataWeb = [[MyWebView alloc]initWithFrame:CGRectMake(0, 0, 375 * FitWidth, (667 - 64) * FitHeight)];
    _chipDataWeb.delegate = self;
    [_chipDataWeb NightWithType:UIViewColorType2];
    [_chipDataWeb.scrollView.subviews objectAtIndex:0].frame = CGRectMake(0, 100, 375, 667) ;
    [self.view addSubview:_chipDataWeb];
   
   [ HTTPMethod getDataByString:@"http://api2.pianke.me/timeline/info" BODYDic:[ChangeString changeStringToDictionary:[NSString stringWithFormat:@"http://api2.pianke.me/timeline/info?auth=&client=1&contentid=%@&deviceid=5AA12B08-7AD2-4ED0-B4EB-571025443952&version=3.0.6", _ID]] WithDataBlock:^(id data) {
       
       NSString *string = [[data objectForKey:@"data"] objectForKey:@"html"] ;
      
       [_chipDataWeb loadHTMLString:string baseURL:nil];
      
       
    }];
   
}

-(void)webViewDidStartLoad:(UIWebView *)webView{
    _HUD = [[XMN_ProgressHUD alloc]initWithFrame:self.view.frame];
    _HUD.backgroundColor = [UIColor colorWithRed:0.89 green:0.89 blue:0.9 alpha:1];
    _HUD.XMN_label.text = @"Waiting...";
    [self.view addSubview:_HUD];
}

-(void)webViewDidFinishLoad:(UIWebView *)webView{
    [_HUD removeFromSuperview];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
